<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import="java.util.List" %>
<%@ page import="my.market.jdbc.dataClass.*" %>
<%@ page import="my.market.jdbc.dao.OrdersDao" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%	Users user = (Users) request.getSession().getAttribute("user");
	OrdersDao ordersDao = new OrdersDao();
	List<Orders> orders = ordersDao.getOrders(user.getMail());
%>
<html>
<head>
<title>订单</title>
<link type="text/css" href="${pageContext.request.contextPath }/pageDisplay/css/main.css" rel="stylesheet" />
</head>
<body class="main">
<%@include file="head.jsp" %>
<div class="content">
<table>
	<tr>
		<td><%@include file="category.jsp" %></td>
		<td><%@include file="search.jsp" %></td>
	</tr>
</table>
</div>
<p>订单管理</p>
<div class="content">
<%	if(orders == null){ %>
<p><font size="10" color="green">你还什么都没有买哦</font></p>
<%	}else{ %>
<table>
	<tr>
		<td>订单编号</td>
		<td>订单金额</td>
		<td>下单时间</td>
		<td>支付状态</td>
	</tr>
	<c:forEach var="order" items="<%=orders %>">
		<tr>
			<td>${order.getId() }</td>
			<td>${order.getTotal_money() }</td>
			<td>${order.getOrder_time() }</td>
			<c:choose>
				<c:when test="${order.getStatus().equals('已支付') }">
					<td>已支付</td>
				</c:when>
				<c:otherwise>
					<td><a href="${pageContext.request.contextPath }/pageDisplay/pay.jsp?id=${order.getId() }" >点击支付</a></td>
				</c:otherwise>
			</c:choose>
		</tr>
	</c:forEach>
</table>
<%	} %>
</div>
<%@include file="foot.jsp" %>
</body>
</html>